package com.leetcode.LC;

import java.util.Arrays;

public class LC455 {
    public int findContentChildren(int[] g, int[] s) {

        Arrays.sort(g);
        Arrays.sort(s);

        int a=0,b=0,count=0;
        while (a<g.length&&b<s.length){
            if(g[a]<=s[b]){
                count++;
                a++;
                b++;
            }else if (g[a]>s[b]){
                b++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        System.out.println(new LC455().findContentChildren(new int[]{1, 2}, new int[]{1, 2, 3}));
    }
}
